package com.company;

public class Main {

    public static void main(String[] args)
    {
	    // write your code here
        //存在Java多态??
        //hello对象是被HelloProxy这个所谓的代理类所创建的

        /*
        IHello hello = new HelloProxy(new Hello()); //开启日志记录 实现静态代理
        //IHello hello=new Hello();
        hello.sayHello("Luke");
        hello.sayGoodBye("Luke");
        */


        /*
        IHello hello = (IHello)new DynaProxyHello().bind(new Hello());
        hello.sayGoodBye("Luke");
        hello.sayHello("Luke");
        */
        //一个代理类 代理了日志操作类和业务逻辑处理类
        IHello hello = (IHello)new DynaProxyHello2().bind(new Hello(),new LoggerOperation());
        hello.sayGoodBye("Luke");
        hello.sayHello("Luke");
    }
}
